home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ccccppppuuuusssseeeetttt((((5555)))) ccccppppuuuusssseeeetttt((((5555))))
-
-
-
- NNNNAAAAMMMMEEEE
- cpuset - overview of cpusets
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- A cpuset is a named set of CPUs, which may be defined to be restricted or
- open. A restricted cpuset only allows processes that are members of the
- cpuset to run on the set of CPUs. An open cpuset allows any process to
- run on its cpus, but a process that is a member of the cpuset can only
- run on the CPUs belonging to the cpuset.
-
- A principal use of cpusets is to create a partition of CPUs within a
- larger system. By doing this, a set of processes can be contained to
- specific CPUs, reducing the amount of interaction those processes have
- with other work on the system. In the case of a restricted cpuset, the
- processes that are attached to that cpuset will not be affected by other
- work on the system; only those processes attached to the cpuset can be
- scheduled to run on the CPUs assigned to the cpuset. An open cpuset can
- be used to restrict processes to a set of CPUs so that the affect these
- processes have on the rest of the system is minimized.
-
- There are currently two methods in which to use cpusets: the _cccc_pppp_uuuu_ssss_eeee_tttt(1)
- command, and the cpuset library (see THE CPUSET LIBRARY section below).
-
- For information on how to use cpusets in a Trusted IRIX environment, see
- the _cccc_pppp_uuuu_ssss_eeee_tttt(1) man page.
-
- TTTTHHHHEEEE CCCCPPPPUUUUSSSSEEEETTTT CCCCOOOOMMMMMMMMAAAANNNNDDDD
- The _cccc_pppp_uuuu_ssss_eeee_tttt command is used to create and destroy cpusets, to retrieve
- information about existing cpusets, and to attach a process and all of
- its children to a cpuset.
-
- The _cccc_pppp_uuuu_ssss_eeee_tttt command uses a cpuset configuration file and a name (see
- _cccc_pppp_uuuu_ssss_eeee_tttt(4) for a definition of the file format). The cpuset configuration
- file is used to define the CPUs that are members of the cpuset. It also
- contains additional parameters required to define the cpuset. A cpuset
- name is between three and eight characters long; names of two or less
- characters are reserved.
-
- The file permissions of the configuration file define access to the
- cpuset. When permissions need to be checked, the current permissions of
- the file are used. It is therefore possible to change access to a
- particular cpuset without having to tear it down and recreate it, simply
- by changing the access permissions. Read access allows a user to
- retrieve information about a cpuset while execute permission allows the
- user to attach a process to the cpuset.
-
- For additional information concerning the _cccc_pppp_uuuu_ssss_eeee_tttt command, consult the
- _cccc_pppp_uuuu_ssss_eeee_tttt(1) manual page.
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- ccccppppuuuusssseeeetttt((((5555)))) ccccppppuuuusssseeeetttt((((5555))))
-
-
-
- THE CPUSET LIBRARY
- The cpuset library provides interfaces that allow a programmer to create
- and destroy cpusets, retrieve information about existing cpusets, to
- attach a process and all of its children to a cpuset, and to attach or
- detach a specific process identified by its PID to or from a cpuset.
-
- The cpuset library requires that a permission file be defined for a
- cpuset that is created. The permissions file may be an empty file, since
- it is only the file permissions for the file that define access to the
- cpuset. When permissions need to be checked, the current permissions of
- the file are used. It is therefore possible to change access to a
- particular cpuset without having to tear it down and recreate it, simply
- by changing the access permissions. Read access allows a user to
- retrieve information about a cpuset while execute permission allows the
- user to attach a process to the cpuset.
-
- The cpuset library is provided as a N32 DSO library. The library file is
- _llll_iiii_bbbb_cccc_pppp_uuuu_ssss_eeee_tttt_...._ssss_oooo, and it is normally located in the directory _////_llll_iiii_bbbb_3333_2222. Users
- of the library must include the _cccc_pppp_uuuu_ssss_eeee_tttt_...._hhhh header file which is located in
- _////_uuuu_ssss_rrrr_////_iiii_nnnn_cccc_llll_uuuu_dddd_eeee. The function interfaces provided in the cpuset library are
- declared as optional interfaces to allow for backwards compatibility as
- new interfaces are added to the library. This library is only available
- on IRIX 6.5.8 and later versions.
-
- It is possible to compile and run a program that uses this DSO and its
- interfaces if they are available, but continues to execute if they are
- missing. To do this, a replacement library for _llll_iiii_bbbb_cccc_pppp_uuuu_ssss_eeee_tttt_...._ssss_oooo must be
- created. An example of how to create a replacement library is provided
- in the EXAMPLES section.
-
- The function interfaces within the cpuset library include:
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_CCCC_rrrr_eeee_aaaa_tttt_eeee(3x)
- Create a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_AAAA_tttt_tttt_aaaa_cccc_hhhh(3x)
- Attach the current process to a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_AAAA_tttt_tttt_aaaa_cccc_hhhh_PPPP_IIII_DDDD(3x)
- Attach a specific process to a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_DDDD_eeee_tttt_aaaa_cccc_hhhh_AAAA_llll_llll(3x)
- Detach all threads from a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_DDDD_eeee_tttt_aaaa_cccc_hhhh_PPPP_IIII_DDDD
- Detach a specific process from a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_DDDD_eeee_ssss_tttt_rrrr_oooo_yyyy(3x)
- Destroy a cpuset
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- ccccppppuuuusssseeeetttt((((5555)))) ccccppppuuuusssseeeetttt((((5555))))
-
-
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_GGGG_eeee_tttt_CCCC_PPPP_UUUU_CCCC_oooo_uuuu_nnnn_tttt(3x)
- Obtain the number of CPUs configured on the system
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_GGGG_eeee_tttt_CCCC_PPPP_UUUU_LLLL_iiii_ssss_tttt(3x)
- Get the list of all CPUs assigned to a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_GGGG_eeee_tttt_NNNN_aaaa_mmmm_eeee(3x)
- Get the name of the cpuset to which a process is attached
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_GGGG_eeee_tttt_NNNN_aaaa_mmmm_eeee_LLLL_iiii_ssss_tttt(3x)
- Get a list names for all defined cpusets
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_GGGG_eeee_tttt_PPPP_IIII_DDDD_LLLL_iiii_ssss_tttt(3x)
- Get a list of all PIDs attached to a cpuset
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_GGGG_eeee_tttt_PPPP_rrrr_oooo_pppp_eeee_rrrr_tttt_iiii_eeee_ssss(3x)
- Get various properties of an existing cpuset.
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_AAAA_llll_llll_oooo_cccc_QQQQ_uuuu_eeee_uuuu_eeee_DDDD_eeee_ffff(3x)
- Allocate a cpuset_QueueDef_t structure
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_FFFF_rrrr_eeee_eeee_PPPP_rrrr_oooo_pppp_eeee_rrrr_tttt_iiii_eeee_ssss(3x)
- Release memory used by a cpuset_Properties_t structure
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_FFFF_rrrr_eeee_eeee_QQQQ_uuuu_eeee_uuuu_eeee_DDDD_eeee_ffff(3x)
- Release memory used by a cpuset_QueueDef_t structure
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_FFFF_rrrr_eeee_eeee_CCCC_PPPP_UUUU_LLLL_iiii_ssss_tttt(3x)
- Release memory used by a cpuset_CPUList_t structure
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_FFFF_rrrr_eeee_eeee_NNNN_aaaa_mmmm_eeee_LLLL_iiii_ssss_tttt(3x)
- Release memory used by a cpuset_NameList_t structure
-
- _cccc_pppp_uuuu_ssss_eeee_tttt_FFFF_rrrr_eeee_eeee_PPPP_IIII_DDDD_LLLL_iiii_ssss_tttt(3x)
- Release memory used by a cpuset_PIDList_t structure
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- This example creates a cpuset named "myqueue" containing CPUs 4, 8, and
- 12. The example uses the interfaces in the cpuset library,
- _////_llll_iiii_bbbb_3333_2222_////_llll_iiii_bbbb_cccc_pppp_uuuu_ssss_eeee_tttt_...._ssss_oooo, if they are present. If the interfaces are not
- present, it attempts to use the _c_p_u_s_e_t(1) command to create the cpuset.
-
- #include <cpuset.h>
- #include <stdio.h>
- #include <errno.h>
-
- #define PERMFILE "/usr/tmp/permfile"
-
- int
- main(int argc, char **argv)
- {
- cpuset_QueueDef_t *qdef;
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- ccccppppuuuusssseeeetttt((((5555)))) ccccppppuuuusssseeeetttt((((5555))))
-
-
-
- char *qname = "myqueue";
- FILE *fp;
-
- /* Alloc queue def for 3 CPU IDs */
- if (_MIPS_SYMBOL_PRESENT(cpusetAllocQueueDef)) {
- printf("Creating cpuset definition\n");
- qdef = cpusetAllocQueueDef(3);
- if (!qdef) {
- perror("cpusetAllocQueueDef");
- exit(1);
- }
-
- /* Define attributes of the cpuset */
- qdef->flags = CPUSET_CPU_EXCLUSIVE
- | CPUSET_MEMORY_LOCAL
- | CPUSET_MEMORY_EXCLUSIVE;
- qdef->permfile = PERMFILE;
- qdef->cpu->count = 3;
- qdef->cpu->list[0] = 4;
- qdef->cpu->list[1] = 8;
- qdef->cpu->list[2] = 12;
- } else {
- printf("Writing cpuset command config"
- " info into %s\n", PERMFILE);
- fp = fopen(PERMFILE, "a");
- if (!fp) {
- perror("fopen");
- exit(1);
- }
- fprintf(fp, "EXCLUSIVE\n");
- fprintf(fp, "MEMORY_LOCAL\n");
- fprintf(fp, "MEMORY_EXCLUSIVE\n\n");
- fprintf(fp, "CPU 4\n");
- fprintf(fp, "CPU 8\n");
- fprintf(fp, "CPU 12\n");
- fclose(fp);
- }
-
- /* Request that the cpuset be created */
- if (_MIPS_SYMBOL_PRESENT(cpusetCreate)) {
- printf("Creating cpuset = %s\n", qname);
- if (!cpusetCreate(qname, qdef)) {
- perror("cpusetCreate");
- exit(1);
- }
- } else {
- char command[256];
-
- fprintf(command, "/usr/sbin/cpuset -q %s -c"
- "-f %s", qname,
- PERMFILE);
- if (system(command) < 0) {
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- ccccppppuuuusssseeeetttt((((5555)))) ccccppppuuuusssseeeetttt((((5555))))
-
-
-
- perror("system");
- exit(1);
- }
- }
-
- /* Free memory for queue def */
- if (_MIPS_SYMBOL_PRESENT(cpusetFreeQueueDef)) {
- printf("Finished with cpuset definition,"
- " releasing memory\n");
- cpusetFreeQueueDef(qdef);
- }
-
- return 0;
- }
-
-
- This example shows how to create a replacement library for
- _////_llll_iiii_bbbb_3333_2222_////_llll_iiii_bbbb_cccc_pppp_uuuu_ssss_eeee_tttt_...._ssss_oooo so that a program built to use the cpuset library
- interfaces will execute if the library is not present.
-
- 1. The file replace.c is created, and contains the following line of
- code:
-
- static void cpusetNULL(void) { }
-
-
- 2. The file replace.c is compiled:
-
- cc -mips3 -n32 -c replace.c
-
-
- 3. The object replace.o created in the previous step is placed in a
- library:
-
- ar ccrl libcpuset.a replace.o
-
-
- 4. The library is converted into a DSO:
-
- ld -mips3 -n32 -quickstart_info -nostdlib \
- -elf -shared -all -soname libcpuset.so \
- -no_unresolved -quickstart_info -set_version \
- sgi1.0 libcpuset.a -o libcpuset.so
-
-
- 5. The DSO is installed on the system:
-
- install -F /opt/lib32 -m 444 -src libcpuset.so \
- libcpuset.so
-
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-
-
-
- ccccppppuuuusssseeeetttt((((5555)))) ccccppppuuuusssseeeetttt((((5555))))
-
-
-
- The replacement library can be installed in a directory defined by the
- LD_LIBRARYN32_PATH environment variable (see _r_l_d(1)). If the replacement
- library must be installed in a directory that is in the default search
- path for shared libraries, it should be installed in _////_oooo_pppp_tttt_////_llll_iiii_bbbb_3333_2222.
-
- NNNNOOOOTTTTEEEESSSS
- In a cluster environment, the cpuset configuration file should reside on
- the root filesystem. If the cpuset configuration file resides on a
- filesystem other than the root filesystem and you attempt to unmount the
- filesystem, the vnode for the cpuset remains active and the _uuuu_nnnn_mmmm_oooo_uuuu_nnnn_tttt (see
- _uuuu_nnnn_mmmm_oooo_uuuu_nnnn_tttt(1M) command fails.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- cpuset(1), cpusetAllocQueueDef(3x), cpusetAttach(3x),
- cpusetAttachPID(3x), cpusetCreate(3x), cpusetDestroy(3x),
- cpusetDetachAll(3x), cpusetDetachPID(3x), cpusetFreeCPUList(3x),
- cpusetFreeNameList(3x), cpusetFreePIDList(3x), cpusetFreeProperties(3x),
- cpusetGetCPUCount(3x), cpusetGetCPUList(3x), cpusetGetName(3x),
- cpusetGetNameList(3x), cpusetGetPIDList(3x), cpusetGetProperties(3x),
- cpuset(4).
-
- _I_R_I_X _A_d_m_i_n: _R_e_s_o_u_r_c_e _A_d_m_i_n_i_s_t_r_a_t_i_o_n
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 6666
-
-
-
-